<?php
/**
 * Created by PhpStorm.
 * User: tangyunfei
 * Date: 2018/11/15
 * Time: 15:05
 */
class IndexAction extends  Action{
    function index(){


        $id = empty($_GET['id'])?Exit():$_GET['id'];//企业ID
        $info = M('Company')->where("id=".$id)->find();
        $cityName = M('city')->where('id='.$info['cityid'])->getField("city");
        $citypy = M('city')->where('id='.$info['cityid'])->getField("pinyin");


        import('ORG.Util.Page');// 导入分页类
        $count      = M('Zhaopin')->where('uid='.$info['uid'])->count();// 查询满足要求的总记录数
        $Page       = new Page($count,25);// 实例化分页类 传入总记录数和每页显示的记录数
        $show       = $Page->show();// 分页显示输出
        // 进行分页数据查询 注意limit方法的参数要使用Page类的属性
        $temp =  M('Zhaopin')->where('uid='.$info['uid'])->order('id DESC')->limit($Page->firstRow.','.$Page->listRows)->select();
        foreach ($temp as $v){
            $v['cate'] =M('Category')->where("id=".$v['cid'])->getField("path");
            $list[]=$v;
        }
        $this->assign('list',$list);//赋值数据集
        $this->assign('page',$show);//赋值分页输出

        $this->assign("cityName",$cityName);

        $this->assign("info",$info);
        $this->assign("citypy",$citypy);
        $this->display();
    }
}